import routes from '~pages'

(() => {
  const no404Flag = process.env.VITE_APP_ROUTE_NO404PAGE
  if (no404Flag) {
    const notFundPage = routes.find(r => r.path === '/:all(.*)*')
    if (notFundPage) {
      notFundPage.redirect = no404Flag === true ? '/' : no404Flag
    }
  }
})()

export default routes
